<template>
	<view class="jzrgl">
		<view v-if="datashow" class="bos">
			<view v-for="(item,index) in list" :key="index" class="bos_list" @click="Onjzrxq(item.id)">
				<view class="flex-row-between">
					<view class="flex-row-start">
						<view class="font-323232 font17 font-b">{{item.the_patient_info.name}}</view>
						<view class="isdefault flex-row-center" v-show="item.isdefault == 1">默认</view>
					</view>
					<view style="color: #12B3F1;" class="font15">编辑</view>
				</view>
				<view style="color: #000000;margin-top: 10rpx;" class="font14">手机号:{{item.the_patient_info.mobile}}</view>
				<view style="color: #000000;margin-top: 10rpx;" class="font14">身份证:{{item.the_patient_info.id_card}}</view>
			</view>
		</view>
		<view class="nodata1" v-else>暂无就诊人</view>
		<view class="bottom_is flex-row-center" @click="Onadd">
			<view class="flex-row-center">添 加 就 诊 人</view>
		</view>
		<view class=".bottom_is1"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				datashow: true, //是否有就诊人
				list: [], //数据
				num: 0, //长度
				defaultobj: {}, //默认就诊人信息
			}
		},
		onShow() {
			//获取数据
			this.Onlistmemberfamily()
		},
		methods: {
			Onlistmemberfamily() {
				this.defaultobj = {}
				this.list = []

				this.$Http({
					url: 'listThePatient',
					data: {}
				}).then(res => {
					if (!res.data || res.data.length == 0) {
						this.datashow = false
					} else {
						this.datashow = true
						this.num = res.data.length
						this.list = res.data
						res.data.forEach(item => {
							if (item.isdefault == 1) {
								this.defaultobj = item
							}
						})
					}
				})
			},
			//添加就诊人
			Onadd() {
				this.$store.commit('Onjzkurl', '/pagesA/my/jzrgl')
				uni.navigateTo({
					url: '/pagesA/my/jzrgladd',
				})
			},
			//详情
			Onjzrxq(id) {
				uni.navigateTo({
					url: '/pagesA/my/jzrxq?id=' + id,
				})
			}
		}
	}
</script>

<style lang="less">
	.jzrgl {
		width: 750rpx;
		background: #F6F6F6;
		height: 100%;
		padding-top: 25rpx;
		.bos_list{
			width: 700rpx;
			padding: 20rpx;
			background-color: #ffffff;
			margin: 0rpx 25rpx 25rpx 25rpx;
			.isdefault{
				width: 50rpx;
				height: 30rpx;
				font-size: 20rpx;
				color: #12B3F1;
				background: #D4F3FF;
				margin-left: 10rpx;
			}
		}

		.nodata1 {
			text-align: center;
			line-height: 100rpx;
			text-align: center;
			font-size: 28rpx;
			color: #969696;
		}

		.bottom_is {
			position: fixed;
			bottom: 0;
			left: 0;
			height: 120rpx;
			width: 750rpx;
			padding-bottom: constant(safe-area-inset-bottom);
			padding-bottom: env(safe-area-inset-bottom);
			box-sizing: content-box;
			z-index: 12;
			view{
				width: 305rpx;
				height: 74rpx;
				background: #12B3F1;
				border-radius: 10rpx;
				font-size: 28rpx;
				color: #ffffff;
			}
		}

		.bottom_is1 {
			height: 140rpx;
			width: 750rpx;
			padding-bottom: constant(safe-area-inset-bottom);
			padding-bottom: env(safe-area-inset-bottom);
			box-sizing: content-box;
		}
	}
</style>